
module.exports = function ($scope, $state, $stateParams,$resource,$modal,items,$modalInstance,FileUploader) {
    console.log(items);
    $scope.a={
        'project_file' : '',
        'city_project':'1',
        'recommend_type':[]
    };
    $scope.info={'photo':''};
    $scope.applyarr=[
    {name:'区县项目',value:'0'},
    {name:'市级项目',value:'1'},
]

       $scope.rfoarr=[
    {name:'人事编制处',value:'1'},
    {name:'政策法规处',value:'2'},
    {name:'规划发展处',value:'3'},
    {name:'区域合作处',value:'4'},
    {name:'市场开发处',value:'5'},
    {name:'行业管理处',value:'6'},
    {name:'机关党委',value:'7'},
    {name:'质监所',value:'8'},
    {name:'发展中心',value:'9'},
    {name:'培训中心',value:'10'},
    {name:'协会秘书处',value:'11'},
]
//调公告类型接口

     $resource('/api/as/ggc/reviewGuide/findInfoTypeList', {}, {}).save({}, function(res){
            // console.log(res);
            if(res.errcode === 0){                      
                console.log(res);
                console.log('上面是res');
                $scope.ntarr=[];
                for(var i =0;i<res.data.length;i++){
                    $scope.ntarr.push({name:i,value:res.data[i].guide_type});
                }
                console.log($scope.ntarr);
            }else{
                alert(res.errmsg);
            }
        });
    


    



$scope.submit = function(){
    console.log($scope.a.recommend_type);
    console.log($scope.picstr);
    if($scope.a.project_name==null||$scope.a.project_name==''||$scope.a.project_name==undefined){
        alert('请填写项目名称');
        return;
    }
    if($scope.a.project_type==null||$scope.a.project_type==''||$scope.a.project_type==undefined){
        alert('请填写项目类别');
        return;
    }
    
    $scope.img = $scope.a.project_file.join(",");
    console.log($scope.img);
    var para = {
        recommend_district:$scope.a.city_project,
        city_project:$scope.a.city_project,
        project_type:$scope.a.project_type,
        project_name:$scope.a.project_name,
        project_file:$scope.img,
        recommend_type:$scope.a.recommend_type
     }

     console.log(para);
     $resource('/api/ac/ggc/reviewCompanyProjectService/createCompanyProject', {}, {}).save(para, function(res){
            // console.log(res);
            if(res.errcode === 0){                      
                alert('提交成功');  
                 $modalInstance.close();
            }else{
                alert(res.errmsg);
            }
        });
}

        $scope.del=function(index){
            $scope.array.splice(index,1);
            $scope.a.project_file=$scope.array;
        }
            $scope.image = function(){
				var para = $state.get('app.imageupload');
				//设置上传文件夹，以自己业务命名
				angular.extend(para, {
					resolve : {  
						'dir' : function(){
							return 't1';
						}
					} 
				})
				console.log(para);
				var modalInstance = $modal.open(para);
				modalInstance.opened.then(function() {// 模态窗口打开之后执行的函数  
					console.log('modal is opened');  
				});  
				modalInstance.result.then(function(result) {  
					console.log(result);  
					$scope.imagearr = JSON.stringify(result);
					// console.log(scope.imagearr);
					$scope.array = result;
                    $scope.a.project_file=$scope.array;
					// $scope.a.project_file = array[0];
					// console.log(scope.info.img);
					// form.result['templete_lock_data_json'] = JSON.stringify(result.lock);
					// form.result['templete_check_data_json'] = result.unlock;

				}, function(reason) {  
					console.log(reason);// 点击空白区域，总会输出backdrop  
					// click，点击取消，则会暑促cancel  
					$log.info('Modal dismissed at: ' + new Date());  
				}); 
			};
			


};
